<template>
	<div>

        <div class="heades">
            <van-nav-bar
                class="tops"
                title="处理收集"
                style="background: #fff;"
                left-arrow
                        @click-left="onClickLeft"
                />
        </div>
        <div class="cones">
            <p><span>运输单位</span><span>{{yun_shu_dan_wei}}</span></p>
            <p><span>垃圾种类</span><span>{{garbageTypeName}}</span></p>
            <p><span>垃圾数量</span><span>{{garbageCount}}{{unit}}</span></p>
            <p><span>处理公司</span><span @click="show_cl = true">{{show_com_text}}</span></p>
            <van-popup v-model="show_cl" position="bottom">
            <van-picker
              show-toolbar
              :columns = "cls"
              @cancel="show_en = false"
              @confirm="onConfirm_cl"
            />
          </van-popup>
            <div class="btn">
                <van-button type="info" @click="sub_info">确认提交</van-button>
            </div>
        </div>
        <div class="foores">
            <h3>分类处理</h3>
            <p>环境卫生专业规划应当公开规划草案，征求公众意见，经市发展改革、国土规划等行政管理部门审查后，由市城市管理行政主管部门报市人民政府审批，并由国土规划行政管理部门纳入城乡规划。</p>
        </div>
  </div>

</template>
<script>
	export default{
		data(){
			return{
          yun_shu_dan_wei:'',
          garbageTypeName:'',
          garbageCount:'',
          unit:'',
          show_cl:false,
          cls:[],
          show_com_text:'请选择处理公司',
          en_userId:'',
          collectOrderIds:'',
          garbageTypeValue:'',
          user:''

			}
        },
      mounted(){
		    let obj = JSON.parse(this.$route.query.re_data);
		    this.yun_shu_dan_wei = obj.transport_name;
        this.garbageTypeName = obj.garbageTypeName;
        this.garbageCount = obj.garbageCount;
        this.unit = obj.unit;
        this.collectOrderIds = obj.collectOrderIds;
        this.garbageTypeValue = obj.garbageTypeValue;
        var handles = obj.handles;
        for(var i = 0;i<handles.length;i++){
            let obj = {};
            obj.text = handles[i].enter;
            obj.val = handles[i].en_userId;
            this.cls.push(obj);
        }
          let local_user = localStorage.getItem('user');
          if(local_user != undefined && local_user != "undefined"){
              let user = JSON.parse(local_user);
              this.user = user;
          }
        console.log(obj);
      },
        methods:{
            onClickLeft(){
              this.$router.go(-1);
            },
            onConfirm_cl(picker){
              console.log(picker);
              this.show_com_text = picker.text;
              this.en_userId = picker.val;
              this.show_cl = false;
            },
            sub_info(){
                console.log(111);

                const that = this;
                let p = "garbageType="+that.garbageTypeValue+"&en_userId="+that.en_userId+
                    "&unit="+that.unit+"&userId="+that.user.userId+"&garbageCount="+that.garbageCount+
                    "&collectOrderIds="+that.collectOrderIds;
                that.$sendRequest('/transport_order/save_transport_order',p).then(function(res){
                    console.log(res.data);
                    if(res.data.code ==0){
                        that.$router.push({
                            path:'/fenLeiYunShu',query:{"active":1}
                        })
                    }else{
                        that.$toast(res.data.msg);
                    }

                })

            }
        }
	}
</script>

<style scoped="scoped">
    .cones p{
        margin: 0;
        padding: 0;
        height: 6vh;
        line-height: 6vh;
        border-bottom: 1px solid rgba(246,246,246,1);
        display: flex;
        margin: 0.2rem 1rem;
    }
    .cones p span{
        padding: 0 2vh;
    }
    .btn .van-button{
        width: 33vh;
        margin-top: 2rem;
        border-radius: 40rem;
    }
    .foores{
        position:fixed;
        bottom:0;
        width: 100%;
        height: 8.2rem;
        text-align: left;
    }
    .foores h3{
        margin: 0;
        padding: 0;
        margin: 0 1.3vh;
        padding-bottom: 0.4rem;
    }
    .foores p{
        margin: 0 1.3vh;
        padding: 0;
        font-size: 0.8rem;
        color:rgba(204,204,204,1);
    }
</style>
